package com.fujimana.rockincat.restree.service;

import java.util.Locale;

import com.fujimana.rockincat.restree.message.MessageRepository;

public class Message {
	
	private static ThreadLocal<MessageRepository> instance = new ThreadLocal<MessageRepository>() {
        protected MessageRepository initialValue() { return (null); }
    };
    
    static void setRepository(MessageRepository repository) {
    	instance.set(repository);
    }
    
	public static String getMessage(Enum<?> id, Object... args) {
		return instance.get().getMessage(id, args);
	}

	public static String getMessage(Enum<?> id, Locale locale, Object... args) {
		return instance.get().getMessage(id, locale, args);
	}

	public static String getMessage(String id, Object... args) {
		return instance.get().getMessage(id, args);
	}

	public static String getMessage(String id, Locale locale, Object... args) {
		return instance.get().getMessage(id, locale, args);
	}
	
}
